<!doctype html>
<html class="no-js fixed-layout">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>首页</title>
  <meta name="description" content="index">
  <meta name="keywords" content="index">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="icon" type="image/png" href="/static/assets/i/favicon.png">
  <link rel="apple-touch-icon-precomposed" href="/static/assets/i/app-icon72x72@2x.png">
  <meta name="apple-mobile-web-app-title" content="Amaze UI" />
  <link rel="stylesheet" href="/static/assets/css/amazeui.min.css"/>
  <link rel="stylesheet" href="/static/assets/css/admin.css">
</head>
<body>



  <div class="admin-content">
    <div class="admin-content-body">

      <div class="am-g">


 
        <div class="am-u-sm-12 am-u-md-12 ">
          <!--中间侧块 注意下面是form表--> 
          <div class="am-form-group">
            <div class="am-g am-margin-top am-form-group">
              <div class="am-u-sm-4 am-u-md-6 am-text-right">旧密码：</div>
              <div class="am-u-sm-8 am-u-md-4 am-u-end" style="padding-left: 0px;">
                <input type="password"  class="am-input-xl" id='password1' name='password1' required="">
              </div>
            </div>
            <hr/>
            <div class="am-g am-margin-top am-form-group">
              <div class="am-u-sm-4 am-u-md-6 am-text-right">新密码：</div>
              <div class="am-u-sm-8 am-u-md-4 am-u-end" style="padding-left: 0px;">
                <input type="password" class="am-input-xl" id='password2' name='password2' required="">
              </div>
            </div>
            <hr/>
            <div class="am-g am-margin-top am-form-group">
              <div class="am-u-sm-4 am-u-md-6 am-text-right">确认密码：</div>
              <div class="am-u-sm-8 am-u-md-4 am-u-end" style="padding-left: 0px;">
                <input type="password"  class="am-input-xl" id='password3' name='password3' required="">
              </div>
            </div>
          </div>
          
        </div>
        <div class="am-u-sm-12 am-u-md-6">
          <div class="am-btn-toolbar">
            <div class="am-btn-group am-btn-group-xs">
            <div class="am-margin">
              <button type="button" class="am-btn am-btn-primary am-btn-xs" onclick="paswd_submit()">保存</button>
            </div>

            </div>
          </div>
        </div>

      </div>
    </div>

  </div>



<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="/static/assets/js/jquery.min.js"></script>
<!--<![endif]-->
<script src="/static/assets/js/amazeui.min.js"></script>
<script src="/static/assets/js/amazeui.tree.js"></script>
<script src="/static/assets/datatables/amazeui.datatables.min.js"></script>
<script src="/static/assets/dialog/amazeui.dialog.min.js"></script>
<link rel="stylesheet" type="text/css" href="/static/assets/css/amazeui.tree.css" />
<script src="/static/assets/js/jquery.md5.js"></script>
<script src="/static/assets/js/app.js"></script>
<script type="text/javascript">
  $("#collapse-nav").addClass("am-in");
  $("#xtgl").removeClass("am-collapsed");
  $("#xtglObmgl").css("color", "#3399CC");
  $("#xtgl").css("color", "#3399CC");
  function department_back(){
    window.history.back(-1);
  }

function newPW(){
    regExp=/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,21}$/;
    if($(".newPW").val()==""){
        $(".popTips").text("密码不能为空");
        $(".popTips").show();
        return false;
    }
    else if(!regExp.test($(".newPW").val())){
        $(".popTips").text("密码格式错误");
        $(".popTips").show();
        return false;
    }
    else{
        $(".popTips").hide();
        return true;
    }
}


function paswd_submit(){
  var password1 = document.getElementById("password1").value;
  var password2 = document.getElementById("password2").value;
  var password3 = document.getElementById("password3").value;
  var paswd1 = $.md5($.trim(password1));
  var paswd2 = $.md5($.trim(password2));
  if(password1==''){
    AlertMSG("原密码不能为空！")
  }else if (password2==''){
    AlertMSG("新密码不能为空！")
  }else if (password2!=password3){
    AlertMSG("两次密码输入不一致！")
  }else if (password2.length>20){
    AlertMSG("密码长度不超过20个字符！")
  }else {
    $.ajax({
      "url":"/XTGL_GRZX_2/?password="+paswd1+"&newpassword="+paswd2+"&password2="+password2+"",
      "datatype":"json",
      "type":"get",
      "async":"false"
      }).success(function(data){
        if (data.status == 1) {
          var index = parent.layer.getFrameIndex(window.name);
          parent.location.reload();
          parent.layer.close(index);
        } else {
          AlertMSG(data.message)
        }
      }).error(function(data){
        AlertMSG("保存失败！")
      });
  }
}


var AlertMSG=function(msg){
    AMUI.dialog.alert({ title: '错误提示', content: msg, onConfirm: function() { console.log('close'); } });
}
</script>
</body>

</html>